import { defineStore } from "pinia";
import { ref, computed } from "vue";
import { FollowUserInfoTypes } from '@/types/organization'

export const useExpertStore = defineStore("expert", () => {
  // 已选择机构
  const selectedCom = ref({
    id: '',
    cname: ''
  });

  // 设置已选择机构ID
  function setSelectCom (comObj: {id: string, cname: string}) {
    selectedCom.value = comObj;
  };

  // 已选择机构跟进人
  const selectedBusiness = ref<FollowUserInfoTypes>();
  // 设置已选择机构跟进人
  function setSelectedBusiness (businessObj?: FollowUserInfoTypes) {
    selectedBusiness.value = businessObj;
  };

  // 医生签名
  const prescriptionSign = ref<String>();
  // 设置医生签名
  function setPrescriptionSign (url: string) {
    prescriptionSign.value = url;
  };
  
  return {
    selectedCom,
    setSelectCom,
    selectedBusiness,
    setSelectedBusiness,
    prescriptionSign,
    setPrescriptionSign
  };
})